package com.tony.juc.ThreadPool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created with IntelliJ IDEA.
 *
 * @Title: NewSingleThreadExecutorDemo001
 * @Auther: 皮蛋布丁
 * @Date: 2022/04/17/19:15
 * @Description:单线程池
 */
public class NewSingleThreadExecutorDemo001 {

    public static void main(String[] args) {
        ExecutorService service = Executors.newSingleThreadExecutor();//单线程池
        for (int i = 0; i < 5; i++) {
            service.submit(()->{
                System.out.printf("【%s】皮蛋布丁%n",Thread.currentThread().getName());
            });
        }

    }
}
